package com.lagou.demo.controller;

import com.lagou.demo.service.Impl.IDemoServiceImpl;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.LagouSecurity;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

/**
 * @author Mrwg
 * @date 2020/4/12
 * @description
 */
@LagouController
@LagouRequestMapping("/demo")
public class DemoController {

    @LagouAutowired
    private IDemoServiceImpl iDemoServiceImpl;
    //http://localhost:8080/demo/query
    @LagouRequestMapping("/query")
    @LagouSecurity("query")
    public String query(HttpServletRequest request, HttpServletResponse response, String name) {
        return iDemoServiceImpl.get(name);
    }


    //http://localhost:8080/demo/handle01?name=wangg
    @LagouRequestMapping("/handle01")
    @LagouSecurity("admin")
    public String handle01(HttpServletRequest request, HttpServletResponse response, String name) {
        return iDemoServiceImpl.get(name);
    }


    //http://localhost:8080/demo/handle02?name=wangg
    @LagouRequestMapping("/handle02")
    @LagouSecurity("admin")
    public String handle02(HttpServletRequest request, HttpServletResponse response, String name) {
        return iDemoServiceImpl.get(name);
    }

}
